# Copyright (c) 2008-2009 Mikhail Chernov 
#
# This file is part of dcExplorer.
#
# dcExplorer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# dcExplorer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dcExplorer.  If not, see <http://www.gnu.org/licenses/>.

# Scripting class with extensions
package dcExplorer::core::Queue;
use strict;
use utf8;
use core::Object;
use base 'dcExplorer::core::Object';
use WeakRef;

@dcExplorer::core::Queue::props = 
	qw(x y);

# Construction methods

sub new 
{
	my $proto = shift;
	my $class = ref($proto) || $proto;
	my $self = $class->SUPER::new;
	weaken($self->{Parent} = shift);
	$self->{'x'} = shift;
	$self->{'y'} = shift;
	$self->{Items} = [];
	bless ($self, $class);
	return $self;
}

sub addItemData
{
	my $self = shift;
	my $task = shift;
	push @{$self->{Items}}, $task;
}

# Internal engine methods

sub getEmpire
{
	my $self = shift;
	return $self->{Parent}->getEmpire();
}

# Scripting interface

sub itemsCount 
{
	my $self = shift;
	return scalar @{$self->{Items}};
}

sub itemData
{
	my $self = shift;
	my $itemN = shift;
	return $self->{Items}->[$itemN];
}

sub dropJob
{
	my $self = shift;
	my $jobID = shift;
	# TODO: Implement.
	die ref($self)."::dropJob is not implemented yet.";
}

sub addJob
{
	my $self = shift;
	my $class = shift;
	# TODO: Implement.
	die ref($self)."::addJob is not implemented yet.";
}

sub addCustomizeTask
{
	my $self = shift;
	my $itemId = shift;
	# TODO: Implement.
	die ref($self)."::addCustomizeTask is not implemented yet.";
}

sub addPackingTask
{
	my $self = shift;
	my $whatToPack = shift;
	my $howManyToPack = shift;
	# TODO: Implement.
	die ref($self)."::addPackingTask is not implemented yet.";
}

sub addPartsPackingTask
{
	my $self = shift;
	my $partId = shift;
	my $lvl = shift;
	my $partsNumber = shift;
	# TODO: Implement.
	die ref($self)."::gddPartsPackingTask is not implemented yet.";
}

1;
